package controller

import (
	"github.com/gin-gonic/gin"
	"github.com/jinzhu/gorm"
	"net/http"
	"ox-love/model"
)

func Register(context *gin.Context) {
	mobile := context.PostFormMap("mobile")
	if len(mobile) != 11 {
		context.JSON(http.StatusUnprocessableEntity, gin.H{"code": http.StatusUnprocessableEntity, "msg": "手机号必须11位"})
		return
	}
	context.JSON(http.StatusOK, gin.H{"message": "pong"})
	return
}
//查询用户是否存在
func isTelphoneExist(db *gorm.DB, telephone string) bool {
	var user model.User
	db.Where("telephone=?",telephone).First(&user)
	if user.ID !=0{
		return true
	}
	return false
}